package com.xu.cloud.sample.service.controller;

import com.xu.cloud.common.advice.annotation.ApiCrypt;
import com.xu.cloud.sample.api.dto.EncryptDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author xuguan
 * @since 2025/3/7
 */
@RestController
@RequestMapping("/api")
@ApiCrypt
@Validated
@Slf4j
public class EncryptApiImpl {

    @PostMapping("/encrypt")
    public EncryptDto encrypt(@Valid EncryptDto dto) {
        log.info("dto={}", dto);

        dto.setId(dto.getId() + "123");
        dto.setMobileNo(dto.getMobileNo() + "123");
        dto.setName(dto.getName() + "123");

        log.info("dto={}", dto);
        return dto;
    }
}
